package com.jiantong.user.impl.service;

import com.jiantong.user.impl.dao.RolesWebDao;
import com.jiantong.user.impl.dao.UserRoleDao;
import com.jiantong.user.model.UserRole;
import com.jiantong.user.service.RolesWebReadService;
import com.jiantong.user.service.UserRoleReadService;
import io.terminus.boot.rpc.common.annotation.RpcProvider;
import io.terminus.common.model.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by niufei on 2017/4/5.
 */
@Slf4j
@Service
@RpcProvider
public class UserRoleReadServiceImpl implements UserRoleReadService {

    private final UserRoleDao userRoleDao;

    @Autowired
    public UserRoleReadServiceImpl(UserRoleDao userRoleDao) {
        this.userRoleDao = userRoleDao;
    }


    @Override
    public Response<UserRole> findbyid(Long id) {
        return Response.ok(userRoleDao.findById(id));
    }

    @Override
    public Response<List<UserRole>> findbykeyword(Map criteria) {
        return Response.ok(userRoleDao.findbykeword(criteria));
    }

}
